<?php

namespace Api\Model;
use Common\Model\ProjectModel as BashModel;
use Api\Model\FileModel;

/**
 * 产品信息表，该表所关联的图片在file_link表中，关联的标签在tag_link中【品牌、案例、类型】均作为标签存在
 * 
 * @author xiaoyutab<xiaoyutab@qq.com>
 * @version v1.0.0
 * @copyright (c) 2017, xiaoyutab
 * @adtime 2018-06-07 15:07:22
 */
class ProjectModel extends BashModel{
    /**
     * 覆盖父类的get_info方法，含带直接获取到的图片信息
     * 
     * @param number $id
     * @param boolean $cache
     * @return array
     * @author xiaoyutab<xiaoyutab@qq.com>
     * @version v1.0.0
     * @copyright (c) 2017, xiaoyutab
     * @adtime 2018-06-07 15:07:22
     */
    public function get_info($id = 0, $cache = false) {
        $info = parent::get_info($id, $cache);
        if(empty($info)){
            return [];
        }
        $info['file'] = (new FileModel())->get_img_type('project', $info['id'], FALSE, 'file_path');
        return $info;
    }
}